﻿//https://leetcode.cn/problems/relative-ranks/solutions/1131693/xiang-dui-ming-ci-by-leetcode-solution-5sua/?envType=problem-list-v2&envId=heap-priority-queue&difficulty=EASY

class Solution {
public:
    vector<string> findRelativeRanks(vector<int>& score)
    {
        unordered_map<int, int> hash;
        for (int i = 0; i < score.size(); i++)
        {
            hash[score[i]] = i;
        }
        sort(score.begin(), score.end(), std::greater<int>());
        vector<string> ret(score.size());
        for (int i = 0; i < score.size(); i++)
        {
            if (i == 0)
                ret[hash[score[0]]] = "Gold Medal";
            else if (i == 1)
                ret[hash[score[1]]] = "Silver Medal";
            else if (i == 2)
                ret[hash[score[2]]] = "Bronze Medal";
            else
                ret[hash[score[i]]] = to_string(i + 1);
        }
        return ret;

    }
};